﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using ApartmentBillsManager.Start.Common;

namespace ApartmentBillsManager.Start.Converters
{
    class CategoriesToHebrewConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is IEnumerable)
            {
                var billCategories = value as IEnumerable;

                var hebrewCategories = new List<string>();

                foreach (var category in billCategories)
                {
                    if (category is BillCategory)
                    {
                        switch ((BillCategory)category)
                        {
                            case BillCategory.Electricity:
                                hebrewCategories.Add("חשמל");
                                break;
                            case BillCategory.Gas:
                                hebrewCategories.Add("גז");
                                break;
                            case BillCategory.Groceries:
                                hebrewCategories.Add("קניות");
                                break;
                            case BillCategory.InternetInfra:
                                hebrewCategories.Add("תשתית אינטרנט");
                                break;
                            case BillCategory.InternetProvider:
                                hebrewCategories.Add("ספק אינטרנט");
                                break;
                            case BillCategory.PropertyTax:
                                hebrewCategories.Add("ארנונה");
                                break;
                            case BillCategory.Water:
                                hebrewCategories.Add("מים");
                                break;
                        }
                    }
                }
                return hebrewCategories;
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
